using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CMS_SUN_IF_Extraction
{
    public partial class frmVerification_VAT_wNoCMS_Form : Form
    {
        private BAL bao = new BAL();
        private DataTable tblSysCtrl = null;
        public frmVerification_VAT_wNoCMS_Form()
        {
            InitializeComponent();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmVerification_VAT_wNoCMS_Form_Load(object sender, EventArgs e)
        {
            /*txtVATCenter.Text = GlobalClass.gCurr_VAT_Center;
            txStart_VAT_num.Text = GlobalClass.gCurr_Start_VAT_Num;
            txtEnd_VAT_num.Text = GlobalClass.gCurr_End_VAT_num;*/
            string vat_num = "";
            tblSysCtrl = bao.get_tbl_SysControl();
            if (tblSysCtrl != null && tblSysCtrl.Rows.Count > 0)
            {

                DataRow r = tblSysCtrl.Rows[0];
                txtVATCenter.Text = r["Curr_VAT_Center"].ToString();
                vat_num = "00000" + r["Curr_start_vat_num"].ToString();
                txStart_VAT_num.Text = vat_num.Substring(vat_num.Length - 5);
                vat_num = "00000" + r["Curr_end_vat_num"].ToString();
                txtEnd_VAT_num.Text = vat_num.Substring(vat_num.Length - 5);
            }

            getData();
            lstVAT_wNoCMS.Columns["Check_Blank"].Visible = false;
        }

     
        private void getData()
        {
            DataTable tbl = bao.get_VAT_wNoCMS();
            if (tbl == null)
                return;
            lstVAT_wNoCMS.DataSource = bindingSource1;
            bindingSource1.DataSource = tbl;
            bindingSource1.ResetBindings(false);
        }        

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            getData();
        }
      
    }
}